home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-10 | 19.3 KB | 464 lines | [TEXT/MPS ] |
- (*
- File: ScalerTypes.mod
-
- Contains: Apple public font scaler object and constant definitions
-
- Version: Technology: Quickdraw GX 1.1
- Package: Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
-
- Copyright: © 1984-1995 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs.applelink.apple.com
- AppleLink: APPLE.BUGS
-
- *)
-
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE ScalerTypes;
-
- IMPORT SYSTEM, Types, GXMath, GXTypes;
-
- (* $PUSH*)
- (* $ALIGN MAC68K*)
- (* $LibExport+*)
- (*$SET scalerTypeIncludes TRUE*)
-
- CONST
- truetypeFontFormatTag* = LONG("true");
- type1FontFormatTag* = LONG("typ1");
- nfntFontFormatTag* = LONG("nfnt");
-
- scaler_first_error* = 1;
- scaler_first_warning* = 1024;
-
- kOFAVersion1Dot0* = $10000;
- kOFAVersion1Dot1* = $10100; (* added scalerVariationInfo *)
-
- scaler_no_problem* = 0; (* Everything went OK *)
- scaler_null_context* = scaler_first_error; (* Client passed a null context pointer *)
- scaler_null_input* = scaler_first_error + 1; (* Client passed a null input pointer *)
- scaler_invalid_context* = scaler_first_error + 2; (* There was a problem with the context *)
- scaler_invalid_input* = scaler_first_error + 3; (* There was a problem with an input *)
- scaler_invalid_font_data* = scaler_first_error + 4; (* A portion of the font was corrupt *)
- scaler_new_block_failed* = scaler_first_error + 5; (* A call to NewBlock() failed *)
- scaler_get_font_table_failed* = scaler_first_error + 6; (* The table was present (length > 0) but couldn't be read *)
- scaler_bitmap_alloc_failed* = scaler_first_error + 7; (* Call to allocate bitmap permanent block failed *)
- scaler_outline_alloc_failed* = scaler_first_error + 8; (* Call to allocate outline permanent block failed *)
- scaler_required_table_missing* = scaler_first_error + 9; (* A needed font table was not found *)
- scaler_unsupported_outline_format* = scaler_first_error + 10; (* Couldn't create an outline of the desired format *)
- scaler_unsupported_stream_format* = scaler_first_error + 11; (* ScalerStreamFont() call can't supply any requested format *)
- scaler_unsupported_font_format* = scaler_first_error + 12; (* No scaler supports the font format *)
- scaler_hinting_error* = scaler_first_error + 13; (* An error occurred during hinting *)
- scaler_scan_error* = scaler_first_error + 14; (* An error occurred in scan conversion *)
- scaler_internal_error* = scaler_first_error + 15; (* Scaler has a bug *)
- scaler_invalid_matrix* = scaler_first_error + 16; (* The transform matrix was unusable *)
- scaler_fixed_overflow* = scaler_first_error + 17; (* An overflow ocurred during matrix operations *)
- scaler_API_version_mismatch* = scaler_first_error + 18; (* Scaler requires a newer/older version of the scaler API *)
- scaler_streaming_aborted* = scaler_first_error + 19; (* StreamFunction callback indicated that streaming should cease *)
- scaler_last_error* = scaler_streaming_aborted;
- scaler_no_output* = scaler_first_warning; (* Couldn't fulfill any glyph request. *)
- scaler_fake_metrics* = scaler_first_warning; (* Returned metrics aren't based on information in the font *)
- scaler_fake_linespacing* = scaler_first_warning; (* Linespacing metrics not based on information in the font *)
- scaler_glyph_substitution* = scaler_first_warning; (* Requested glyph out of range, a substitute was used *)
- scaler_last_warning* = scaler_glyph_substitution;
-
-
- TYPE
- scalerError* = LONGINT;
-
- (* ScalerOpen output type *)
- scalerInfo* = RECORD
- format*: GXTypes.gxFontFormatTag; (* Font format supported by this scaler *)
- scalerVersion*: Types.Fixed; (* Version number of the scaler *)
- APIVersion*: Types.Fixed; (* Version of API implemented (compare with version in scalerContext) *)
- END;
-
- (* ScalerNewFont output type *)
-
- CONST
- requiresLayoutFont* = 1;
- hasNormalLayoutFont* = 2;
- canReorderFont* = 4;
- canRearrangeFont* = 8;
- hasOutlinesFont* = 16;
-
-
- TYPE
- scalerFontFlag* = LONGINT;
-
- scalerFontInfo* = RECORD
- unitsPerEm*: LONGINT;
- flags*: scalerFontFlag;
- numGlyphs*: LONGINT;
- END;
-
- (* ScalerNewTransform input types *)
- (* ScalerNewVariation1Dot1 output type *)
- scalerFixedRectangle* = RECORD
- left*: Types.Fixed;
- top*: Types.Fixed;
- right*: Types.Fixed;
- bottom*: Types.Fixed;
- END;
-
- scalerVariationInfo* = RECORD
- bounds*: scalerFixedRectangle;
- END;
-
- (* ScalerNewTransform input types *)
-
- CONST
- applyHintsTransform* = 1; (* Execute hinting instructions (grid fit) *)
- exactBitmapTransform* = 2; (* Use embedded gxBitmap iff exact size *)
- useThresholdTransform* = 4; (* Use scaled gxBitmap (if any) if below outline threshold *)
- verticalTransform* = 8; (* Glyphs will be in vertical orientation *)
- deviceMetricsTransform* = 16; (* All metrics should be device (vs. fractional) *)
- allScalerTransformFlags* = applyHintsTransform + exactBitmapTransform + useThresholdTransform + verticalTransform + deviceMetricsTransform;
-
-
- TYPE
- scalerTransformFlag* = LONGINT;
-
- scalerTransform* = RECORD
- flags*: scalerTransformFlag; (* Hint, embedded gxBitmap control, etc. *)
- pointSize*: Types.Fixed; (* The desired pointsize *)
- fontMatrix*: POINTER TO GXMath.gxMapping; (* The 3x3 matrix to apply to glyphs *)
- resolution*: GXMath.gxPoint; (* 2D device resolution *)
- spotSize*: GXMath.gxPoint; (* 2D pixel size *)
- END;
-
- (* ScalerNewTransform output type *)
- scalerTransformInfo* = RECORD
- before*: GXMath.gxPoint; (* Spacing of the line before *)
- after*: GXMath.gxPoint; (* Spacing of the line after *)
- caretAngle*: GXMath.gxPoint; (* Rise (y) and run (x) of the insertion caret *)
- caretOffset*: GXMath.gxPoint; (* Adjustment to caret for variants like italic *)
- END;
-
- (* ScalerNewGlyph input types *)
-
- CONST
- noImageGlyph* = 1; (* Don't return the bitmap image for this glyph *)
-
-
- TYPE
- scalerGlyphFlag* = LONGINT;
-
- (* QuickDraw GX outline *)
-
- CONST
- pathOutlineFormat* = LONG("path");
-
-
- TYPE
- scalerOutlineFormat* = LONGINT;
-
- scalerGlyph* = RECORD
- glyphIndex*: LONGINT; (* Index of the glyph to be considered *)
- bandingTop*: LONGINT; (* Banding controls (scanline numbers) top=bottom=0 means no banding *)
- bandingBottom*: LONGINT;
- format*: scalerOutlineFormat; (* Format of outline to return, ignored if no outline desired *)
- flags*: scalerGlyphFlag; (* Control generation of image representation *)
- END;
-
- (* ScalerNewGlyph output types *)
- scalerMetrics* = RECORD
- advance*: GXMath.gxPoint;
- sideBearing*: GXMath.gxPoint;
- otherSideBearing*: GXMath.gxPoint;
- END;
-
- scalerRectangle* = RECORD
- xMin*: LONGINT;
- yMin*: LONGINT;
- xMax*: LONGINT;
- yMax*: LONGINT;
- END;
-
- (* ScalerKernGlyphs input/output types *)
-
- CONST
- lineStartKerning* = 1; (* Array of glyphs starts a line *)
- lineEndKerning* = 2; (* Array of glyphs ends a line *)
- noCrossKerning* = 4; (* Prohibit cross kerning *)
- allScalerKerningFlags* = lineStartKerning + lineEndKerning + noCrossKerning;
-
-
- TYPE
- scalerKerningFlag* = LONGINT;
-
-
- CONST
- noStakeKerningNote* = 1; (* Indicates a glyph was involver in a kerning pair/group *)
- crossStreamResetKerningNote* = 2; (* Indicates a return-to-baseline in cross-stream kerning *)
-
-
- TYPE
- scalerKerningNote* = INTEGER;
-
-
- CONST
- noKerningAppliedOutput* = $0001; (* All kerning values were zero, kerning call had no effect *)
-
- (* These are bit-fields *)
-
- TYPE
- scalerKerningOutput* = LONGINT;
-
- scalerKerning* = RECORD
- numGlyphs*: LONGINT; (* Number of glyphs in the glyphs array *)
- scaleFactor*: Types.Fract; (* Amount of kerning to apply (0 == none, fract1 == all) *)
- flags*: scalerKerningFlag; (* Various control flags *)
- glyphs*: SYSTEM.PTR (*ΔΔ POINTER TO INTEGER*); (* Pointer to the array of glyphs to be kerned *)
- info*: scalerKerningOutput; (* Qualitative results of kerning *)
- END;
-
- (* ScalerStream input/output types *)
-
- CONST
- cexec68K* = $0001;
- truetypeStreamType* = $0001;
- type1StreamType* = $0002;
- type3StreamType* = $0004;
- type42StreamType* = $0008;
- type42GXStreamType* = $0010;
- portableStreamType* = $0020;
- flattenedStreamType* = $0040;
- evenOddModifierStreamType* = $8000;
-
- (* Possible streamed font formats *)
-
- TYPE
- scalerStreamTypeFlag* = LONGINT;
-
-
- CONST
- downloadStreamAction* = 0; (* Transmit the (possibly sparse) font data *)
- asciiDownloadStreamAction* = 1; (* Transmit font data to a 7-bit ASCII destination *)
- fontSizeQueryStreamAction* = 2; (* Estimate in-printer memory used if the font were downloaded *)
- encodingOnlyStreamAction* = 3; (* Transmit only the encoding for the font *)
- prerequisiteQueryStreamAction* = 4; (* Return a list of prerequisite items needed for the font *)
- prerequisiteItemStreamAction* = 5; (* Transmit a specified prerequisite item *)
- variationQueryStreamAction* = 6; (* Return information regarding support for variation streaming *)
- variationPSOperatorStreamAction* = 7; (* Transmit Postscript code necessary to effect variation of a font *)
-
-
- TYPE
- scalerStreamAction* = LONGINT;
-
-
- CONST
- selectAllVariations* = -1; (* Special variationCount value meaning include all variation data *)
-
-
- TYPE
- scalerPrerequisiteItem* = RECORD
- enumeration*: LONGINT; (* Shorthand tag identifying the item *)
- size*: LONGINT; (* Worst case vm in printer item requires *)
- name*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF Types.SInt8; (* unsigned char *) (* Name to be used by the client when emitting the item (Pascal string) *)
- END;
-
- scalerStream* = RECORD
- streamRefCon*: Types.Ptr; (* <- private reference for client *)
- targetVersion*: POINTER TO ARRAY OF CHAR; (* <- e.g. Postscript printer name (C string) *)
- types*: scalerStreamTypeFlag; (* <-> Data stream formats desired/supplied *)
- action*: scalerStreamAction; (* <- What action to take *)
- memorySize*: LONGINT; (* -> Worst case memory use (vm) in printer or as sfnt *)
- variationCount*: LONGINT; (* <- The number of variations, or selectAllVariations *)
- variations*: POINTER TO GXTypes.gxFontVariation; (* <- A pointer to an array of the variations *)
- (*ΔΔ CASE INTEGER OF
- 0: ( *)
- END;
- scalerStream0* = RECORD(scalerStream)
- encoding*: SYSTEM.PTR (*ΔΔ POINTER TO INTEGER*); (* <- Intention is * unsigned short[256] *)
- glyphBits*: SYSTEM.PTR (*ΔΔ POINTER TO LONGINT*); (* <-> Bitvector*: a bit for each glyph, 1* = desired/supplied *)
- name*: POINTER TO ARRAY OF CHAR; (* <-> The printer font name to use/used (C string) *)
- (*ΔΔ );
- 1: ( *)
- END;
- scalerStream1* = RECORD(scalerStream)
- size*: LONGINT; (* -> Memory.Size of the prereq. list in bytes (0 indicates no prerequisites)*)
- list*: Types.Ptr; (* <- Pointer to client block to hold list (nil* = list size query only) *)
- (*ΔΔ );
- 2: ( *)
- END;
- scalerStream2* = RECORD(scalerStream)
- prerequisiteItem*: LONGINT; (* <- Enumeration value for the prerequisite item to be streamed.*)
- (*ΔΔ );
- 3: ( *)
- END;
- scalerStream3* = RECORD(scalerStream)
- variationQueryResult*: LONGINT; (* -> Output from the variationQueryStreamAction *)
- (*ΔΔ );*)
- END;
-
- scalerStreamData* = RECORD
- hexFlag*: LONGINT; (* Indicates that the data is to be interpreted as hex, versus binary *)
- byteCount*: LONGINT; (* Number of bytes in the data being streamed *)
- data*: Types.Ptr; (* Pointer to the data being streamed *)
- END;
-
-
- CONST
- scalerScratchBlock* = -1; (* Scaler alloced/freed temporary memory *)
- scalerOpenBlock* = 0; (* Five permanent input/state block types *)
- scalerFontBlock* = 1;
- scalerVariationBlock* = 2;
- scalerTransformBlock* = 3;
- scalerGlyphBlock* = 4;
- scalerBlockCount* = 5; (* Number of permanent block types *)
- scalerOutlineBlock* = scalerBlockCount; (* Two output block types *)
- scalerBitmapBlock* = scalerBlockCount + 1;
-
-
- TYPE
- scalerBlockType* = LONGINT;
-
- (* special tag used only by scalers to access an sfnt's directory *)
-
- CONST
- sfntDirectoryTag* = LONG("dir ");
-
- (* Type definitions for function pointers used with the scalerContext structure *)
- TYPE
- GetFontTableProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; tableTag: gxFontTableTag; offset: LONGINT; length: LONGINT; data: (*ΔΔUNIVΔΔ*) Types.Ptr): LONGINT;
- ReleaseFontTableProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; fontData: (*ΔΔUNIVΔΔ*) Types.Ptr);
- NewBlockProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; size: LONGINT; theType: scalerBlockType; oldBlock: (*ΔΔUNIVΔΔ*) Types.Ptr): Types.Ptr;
- DisposeBlockProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; scratchData: (*ΔΔUNIVΔΔ*) Types.Ptr; theType: scalerBlockType);
- StreamFunctionProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; VAR streamInfo: scalerStream; (*CONST*)VAR dataInfo: scalerStreamData): LONGINT;
- ScanLineFunctionProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; (*CONST*)VAR scanLine: scalerBitmap);
- PostErrorFunctionProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; theProblem: scalerError);
- ScalerFunctionProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (VAR context: scalerContext; data: (*ΔΔUNIVΔΔ*) Types.Ptr);
- GetFontTableUPP* = Types.UniversalProcPtr;
- ReleaseFontTableUPP* = Types.UniversalProcPtr;
- NewBlockUPP* = Types.UniversalProcPtr;
- DisposeBlockUPP* = Types.UniversalProcPtr;
- StreamFunctionUPP* = Types.UniversalProcPtr;
- ScanLineFunctionUPP* = Types.UniversalProcPtr;
- PostErrorFunctionUPP* = Types.UniversalProcPtr;
- ScalerFunctionUPP* = Types.UniversalProcPtr;
-
- scalerBitmap* = RECORD
- image*: SYSTEM.PTR (*ΔΔ POINTER TO CHAR*); (* Pointer to pixels *)
- topLeft*: GXMath.gxPoint; (* Bitmap positioning relative to client's origin *)
- bounds*: scalerRectangle; (* Bounding box of bitmap *)
- rowBytes*: LONGINT; (* Width in bytes *)
- END;
-
- (* scalerContext*: the vehicle with which the caller and scaler communicate *)
- scalerContext* = RECORD
- version*: Types.Fixed; (* Version of the scaler API implemented by the caller *)
- theFont*: Types.Ptr; (* Caller's private reference to the font being processed *)
- format*: GXTypes.gxFontFormatTag; (* Format of the sfnt font data, corresponds to the scaler *)
- GetFontTable*: GetFontTableUPP; (* Callback for accessing sfnt tables or portions thereof *)
- ReleaseFontTable*: ReleaseFontTableUPP; (* Callback for releasing sfnt tables *)
- NewBlock*: NewBlockUPP; (* Callback for allocating and/or growing permanent and scratch blocks *)
- DisposeBlock*: DisposeBlockUPP; (* Callback for freeing permanent and scratch blocks *)
- StreamFunction*: StreamFunctionUPP; (* Callback for transmitting blocks of data during streaming *)
- ScanLineFunction*: ScanLineFunctionUPP; (* Callback for emitting individual bitmap scanlines during scan conversion *)
- PostErrorFunction*: PostErrorFunctionUPP; (* Callback for posting errors and warnings *)
- scalerBlocks*: ARRAY (*ΔΔ[0..*)scalerBlockCount(*ΔΔ -1]ΔΔ*) OF Types.Ptr; (* Array of permanent scaler blocks *)
- ScalerFunction*: ScalerFunctionUPP; (* Callback for scaler-specific tracing, debugging, etc. *)
- END;
-
-
- CONST
- uppGetFontTableProcInfo* = $0000FFF1; (* PROCEDURE (4 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param): 4 byte result; *)
- uppReleaseFontTableProcInfo* = $000003C1; (* PROCEDURE (4 byte param, 4 byte param); *)
- uppNewBlockProcInfo* = $00003FF1; (* PROCEDURE (4 byte param, 4 byte param, 4 byte param, 4 byte param): 4 byte result; *)
- uppDisposeBlockProcInfo* = $00000FC1; (* PROCEDURE (4 byte param, 4 byte param, 4 byte param); *)
- uppStreamFunctionProcInfo* = $00000FF1; (* PROCEDURE (4 byte param, 4 byte param, 4 byte param): 4 byte result; *)
- uppScanLineFunctionProcInfo* = $000003C1; (* PROCEDURE (4 byte param, 4 byte param); *)
- uppPostErrorFunctionProcInfo* = $000003C1; (* PROCEDURE (4 byte param, 4 byte param); *)
- uppScalerFunctionProcInfo* = $000003C1; (* PROCEDURE (4 byte param, 4 byte param); *)
-
- PROCEDURE NewGetFontTableProc*(userRoutine: GetFontTableProcPtr): GetFontTableUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewReleaseFontTableProc*(userRoutine: ReleaseFontTableProcPtr): ReleaseFontTableUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewNewBlockProc*(userRoutine: NewBlockProcPtr): NewBlockUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewDisposeBlockProc*(userRoutine: DisposeBlockProcPtr): DisposeBlockUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewStreamFunctionProc*(userRoutine: StreamFunctionProcPtr): StreamFunctionUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewScanLineFunctionProc*(userRoutine: ScanLineFunctionProcPtr): ScanLineFunctionUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewPostErrorFunctionProc*(userRoutine: PostErrorFunctionProcPtr): PostErrorFunctionUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE NewScalerFunctionProc*(userRoutine: ScalerFunctionProcPtr): ScalerFunctionUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE CallGetFontTableProc*(VAR context: scalerContext; tableTag: GXTypes.gxFontTableTag; offset: LONGINT; length: LONGINT; data: (*ΔΔUNIVΔΔ*) Types.Ptr; userRoutine: GetFontTableUPP): LONGINT;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallReleaseFontTableProc*(VAR context: scalerContext; fontData: (*ΔΔUNIVΔΔ*) Types.Ptr; userRoutine: ReleaseFontTableUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallNewBlockProc*(VAR context: scalerContext; size: LONGINT; theType: scalerBlockType; oldBlock: (*ΔΔUNIVΔΔ*) Types.Ptr; userRoutine: NewBlockUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallDisposeBlockProc*(VAR context: scalerContext; scratchData: (*ΔΔUNIVΔΔ*) Types.Ptr; theType: scalerBlockType; userRoutine: DisposeBlockUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallStreamFunctionProc*(VAR context: scalerContext; VAR streamInfo: scalerStream; (*CONST*)VAR dataInfo: scalerStreamData; userRoutine: StreamFunctionUPP): LONGINT;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallScanLineFunctionProc*(VAR context: scalerContext; (*CONST*)VAR scanLine: scalerBitmap; userRoutine: ScanLineFunctionUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallPostErrorFunctionProc*(VAR context: scalerContext; theProblem: scalerError; userRoutine: PostErrorFunctionUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- PROCEDURE CallScalerFunctionProc*(VAR context: scalerContext; data: (*ΔΔUNIVΔΔ*) Types.Ptr; userRoutine: ScalerFunctionUPP);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- (* $ALIGN RESET*)
- (* $POP*)
-
- END ScalerTypes.
-